package file;

import command.Cmd;
import common.ParseException;

import java.util.ArrayList;

public class BaseFile {
    private ArrayList<Cmd> cmds;

    public BaseFile() throws ParseException {
        cmds=new ArrayList<Cmd>();
        for (File file : Files.getIncludeFiles())
            for(Cmd cmd : file.getCmds())
                cmds.add(cmd.getCopy());
    }
    
    public void print(){
        System.out.println("\n\nAutoStyle.css filee");
        for (Cmd cmd : cmds)
            print(2,cmd);
    }

    private void print(int tshift, Cmd cmd) {
        System.out.printf("%" + tshift + "s%s\n", "", cmd);
        for (Cmd tCmd : cmd.getBody())
            print(tshift + 2, tCmd);
    }
}
